Enable APC
2014/09/13 |
Enable APC ( Alternative PHP Cache ) and makes PHP be fast.
|
|
[1] | Install APC. |
[root@www ~]#
yum -y install php-pecl-apc
[root@www ~]#
vi /etc/php.d/apc.ini # line 12: specify shared memory(MB) # need to consider with specs of the server apc.shm_size= 512M
/etc/rc.d/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] |
[2] | Create phpinfo like follows and make sure APC enabled. |
[root@www ~]# echo -e "<?php\nphpinfo();\n?>" > /var/www/html/phpinfo.php |
[3] | Enable the admin script of APC. |
[root@www ~]#
vi /usr/share/php-pecl-apc/apc.php # line 41,42: set admin username and password defaults('ADMIN_USERNAME',' apc ');defaults('ADMIN_PASSWORD',' adminpassword ');
[root@www ~]#
vi /etc/httpd/conf.d/apc.conf # create new
Alias /apc /usr/share/php-pecl-apc
<Location /apc> Order Deny,Allow Deny from all Allow from 127.0.0.1 10.0.0.0/24 # IP address you permit </Location> /etc/rc.d/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] |
Access to "http://(hostname or IP address)/apc/apc.php" with Web browser. Then following screen is shown and it's possible to make sure status of APC. |